package server.workwithmaster;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import abstractservlet.AbstractServlet;
import autoservice.api.controller.IAutoservice;
import controllers.Autoservice;

@WebServlet("/RemoveMaster")
public class RemoveMaster extends AbstractServlet {
	private static final String REMOVE_MASTER_PAGE = "/workwithmasterpages/RemoveMasterPage.jsp";
	private static final String MASTER_NAME = "masterName";
	private static final String REMOVE_MASTER_OPERAT = "remove master";
	private static final long serialVersionUID = 1L;
	private IAutoservice autoservice = Autoservice.getInstance();

	public RemoveMaster() {
		super();

	}

	protected void doGet(HttpServletRequest request,
			HttpServletResponse response) throws ServletException, IOException {
		String parameters = request.getParameter(MASTER_NAME);
		super.navigate(request, response, REMOVE_MASTER_OPERAT, autoservice
				.deleteMaster(parameters).get(0), REMOVE_MASTER_PAGE);

	}

}
